package com.sskj.b70.m.bean;

import android.text.TextUtils;

import com.sskj.b70.R;
import com.sskj.b70.common.App;
import com.sskj.b70.utils.NumberUtil;
import com.sskj.b70.utils.TimeFormatUtil;

import java.util.Date;

/**
 * Created by Administrator on 2018/5/3.
 */

public class Entrust {


    /**
     * id : 106
     * stockUserId : 58
     * stockCode : BTC/USDT
     * stockName : BTC/USDT
     * billPriceType : 1
     * entrustNo : 1533108362553zt84g30pu
     * entrustNum : 5
     * dealNum : 5
     * entrustPrice : 0
     * dealPrice :
     * totalPrice : 0
     * fee : 0
     * dealTime :
     * state : 0
     * createTime : 1533108362000
     * isDeleted : false
     * timestamp : 1533108362000
     * iniFee : 0
     */

    private int id;
    private int stockUserId;
    private String stockCode;
    private String stockName;
    private int billPriceType;
    private int tradeType;
    private String entrustNo;
    private double entrustNum;
    private double dealNum;
    private double entrustPrice;
    private String dealPrice;
    private String totalPrice;
    private double fee;
    private String dealTime;
    private int state;
    private String createTime;
    private boolean isDeleted;
    private String timestamp;
    private double iniFee;

    public String getPriceUnit() {
        if (TextUtils.isEmpty(stockName)) {
            return "";
        } else {
            String[] split = stockName.split("/");
            if (split.length > 1) {
                return split[1];
            } else {
                return "";
            }
        }
    }

    public String getNumUnit() {
        if (TextUtils.isEmpty(stockName)) {
            return "";
        } else {
            String[] split = stockName.split("/");
            return split[0];
        }
    }

    public int getTradeType() {
        return tradeType;
    }

    public void setTradeType(int tradeType) {
        this.tradeType = tradeType;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getStockUserId() {
        return stockUserId;
    }

    public void setStockUserId(int stockUserId) {
        this.stockUserId = stockUserId;
    }

    public String getStockCode() {
        return stockCode;
    }

    public void setStockCode(String stockCode) {
        this.stockCode = stockCode;
    }

    public String getStockName() {
        return stockName;
    }

    public void setStockName(String stockName) {
        this.stockName = stockName;
    }

    public int getBillPriceType() {
        return billPriceType;
    }

    public void setBillPriceType(int billPriceType) {
        this.billPriceType = billPriceType;
    }

    public String getEntrustNo() {
        return entrustNo;
    }

    public void setEntrustNo(String entrustNo) {
        this.entrustNo = entrustNo;
    }

    public String getEntrustNum() {
        return NumberUtil.keepMax(entrustNum, 8);
    }

    public void setEntrustNum(double entrustNum) {
        this.entrustNum = entrustNum;
    }

    public String getDealNum() {
        return NumberUtil.keepMax(dealNum, 8);
    }

    public void setDealNum(double dealNum) {
        this.dealNum = dealNum;
    }

    public String getEntrustPrice() {
        return NumberUtil.keep4(entrustPrice + "");
    }

    public void setEntrustPrice(double entrustPrice) {
        this.entrustPrice = entrustPrice;
    }

    public String getDealPrice() {
        return TextUtils.isEmpty(dealPrice) ? "0.0000" : NumberUtil.keepMax8(dealPrice);
    }

    public void setDealPrice(String dealPrice) {
        this.dealPrice = dealPrice;
    }

    public String getTotalPrice() {
        return NumberUtil.keep4(totalPrice);
    }

    public void setTotalPrice(String totalPrice) {
        this.totalPrice = totalPrice;
    }

    public double getFee() {
        return fee;
    }

    public void setFee(double fee) {
        this.fee = fee;
    }

    public String getDealTime() {
        return dealTime;
    }

    public void setDealTime(String dealTime) {
        this.dealTime = dealTime;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public String getCreateTime() {
        if (createTime.charAt(0) == '1') {
            return TimeFormatUtil.SF_FORMAT_G.format(new Date(Long.valueOf(createTime)));
        } else {
            return App.INSTANCE.getString(R.string.strEntrust7);
        }
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public boolean isDeleted() {
        return isDeleted;
    }

    public void setDeleted(boolean deleted) {
        isDeleted = deleted;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public double getIniFee() {
        return iniFee;
    }

    public void setIniFee(double iniFee) {
        this.iniFee = iniFee;
    }
}
